package com.shibo.order.feign.fallback;
import java.math.BigDecimal;

import com.shibo.order.feign.ProductFeignClient;
import com.shibo.product.entity.Product;
import org.springframework.stereotype.Component;

@Component
public class ProductFeignClientFallBack implements ProductFeignClient {
    @Override
    public Product getProduct(Long id) {
        System.out.println("服务调用失败，返回默认值"); //兜底回调
        Product product = new Product();
        product.setId(id);
        product.setPrice(new BigDecimal("0"));
        product.setProductName("未知商品");
        product.setNum(0);

        return product;
    }
}
